﻿<%@ Page Title="" Language="C#" MasterPageFile="~/manager.Master" AutoEventWireup="true" CodeBehind="Promotion.aspx.cs" Inherits="Bus_proj.website.Promotion" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="../Styles/Stylebuttoncss.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/textbox.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 444px;
        }
        .style3
        {
            width: 105px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button3" EventName="Click" />
</Triggers>
<fieldset class="el03">
<legend>กำหนดโปรโมชั่น</legend>
<fieldset class="el02">
<legend>เพิ่มโปรโมชั่นรถโดยสาร</legend>
    <table class="style1">
        <tr>
            <td align="right" class="style2">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label1" runat="server" Text="หมายเลขโปรโมชั่น :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server" CssClass="textbox"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label2" runat="server" Text="รายละเอียดโปรโมชั่น :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox4" runat="server" Height="91px" TextMode="MultiLine" 
                    Width="237px" CssClass="textbox"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label5" runat="server" Text="รหัสเส้นทาง :"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="DropDownList1" runat="server" 
                    DataSourceID="LinqDataSource2" DataTextField="Route_id" 
                    DataValueField="Route_id" Width="145px" CssClass="textbox">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
                    ContextTypeName="Bus_proj.DataClasses1DataContext" EntityTypeName="" 
                    TableName="Table_Routes">
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label3" runat="server" Text="ส่วนลด :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server" TextMode="Number" CssClass="textbox"></asp:TextBox>
                <asp:Label ID="Label4" runat="server" Text="%"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server" OnClientClick="return confirm('ยืนยันการเพิ่มรายการ')" Height="36px" Text="เพิ่มโปรโมชั่น" 
                    Width="147px" CssClass="classname" onclick="Button1_Click" />
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</fieldset>
<fieldset class="el02">
<legend>ตารางแสดงโปรโมชั่น</legend>
<table class="style1">
        <tr>
            <td align="center" colspan="3">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                    BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" 
                    CellPadding="4" DataKeyNames="Promotion_id" DataSourceID="SqlDataSource1" 
                    ForeColor="Black" GridLines="Vertical" Width="795px" AllowPaging="True" 
                    PageSize="5">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:CheckBox ID="CheckBox1" runat="server" />
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:CheckBox ID="CheckBox1" runat="server" />
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Promotion_id" HeaderText="รหัสโปรโมชั่น" 
                            ReadOnly="True" SortExpression="Promotion_id">
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Promotion_name" HeaderText="รายละเอียด" 
                            SortExpression="Promotion_name">
                        <HeaderStyle Width="320px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Promotion_discount" 
                            HeaderText="ส่วนลด" SortExpression="Promotion_discount">
                        <HeaderStyle Width="75px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Route_id" HeaderText="รหัสเส้นทาง" 
                            SortExpression="Route_id">
                        <HeaderStyle Width="100px" />
                        </asp:BoundField>
                        <asp:CheckBoxField DataField="Promotion_status" HeaderText="สถานะการเปิดใช้งาน" 
                            SortExpression="Promotion_status">
                        </asp:CheckBoxField>
                    </Columns>
                    <FooterStyle BackColor="#CCCC99" />
                    <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                    <RowStyle BackColor="#F7F7DE" />
                    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#FBFBF2" />
                    <SortedAscendingHeaderStyle BackColor="#848384" />
                    <SortedDescendingCellStyle BackColor="#EAEAD3" />
                    <SortedDescendingHeaderStyle BackColor="#575357" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:Bus_proConnectionString %>" 
                    SelectCommand="SELECT Table_Promotion.Promotion_id, Table_Promotion.Promotion_name, Table_Promotion.Promotion_discount, Table_Promotion_round.Route_id, Table_Promotion.Promotion_status FROM Table_Promotion INNER JOIN Table_Promotion_round ON Table_Promotion.Promotion_id = Table_Promotion_round.Promotion_id">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td class="style3">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button2" runat="server" OnClientClick="return confirm('ยืนยันการเปิดการใช้งานรายการ')" onclick="Button2_Click1" 
                    style="margin-left: 387px" Text="เปิดใช้งาน" CssClass="classname" 
                    Height="36px" Width="125px" />
                <asp:Button ID="Button3" runat="server" OnClientClick="return confirm('ยืนยันการปิดการใช้งานรายการ')" onclick="Button3_Click" 
                    Text="ปิดใช้งาน" CssClass="classname" Height="36px" Width="119px" />
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3">
                &nbsp;</td>
            <td colspan="2">
                &nbsp;</td>
        </tr>
    </table>
</fieldset>
</fieldset>
    </ContentTemplate>
    </asp:UpdatePanel>

</asp:Content>
